import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  plugins: [vue()],
  resolve: {
    // https://cn.vitejs.dev/config/#resolve-alias
    alias: {
      // 设置路径
      "~": path.resolve(__dirname, "./"),
      // 设置别名
      "@": path.resolve(__dirname, "./src"),
    },
    // https://cn.vitejs.dev/config/#resolve-extensions
    extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json", ".vue"],
  },

  // vite 相关配置
  server: {
    port: 80,
    host: true,
    open: true,
    proxy: {
      // https://cn.vitejs.dev/config/#server-proxy
      "/nursing-dev-api": {
        //http://127.0.0.1:28089/nursing-dev-api/printTable/getGradeTableDate?operationId=286420&type=101
        // target: "http://172.16.1.79:28089",
        target: "http://192.168.10.188:28089",

        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/nursing-dev-api/, ""),
      },
    },
  },
});
